package cn.aylog.servicebase.handler;

import cn.aylog.common.entity.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(Exception.class) // 指定捕获的异常
    @ResponseBody
    public R globalHandler(Exception e) {
        e.printStackTrace();
        return R.error().message("全局处理异常");
    }

}
